//package com.ruoyi.lock.controller;
//
//import com.ruoyi.common.annotation.Log;
//import com.ruoyi.common.core.controller.BaseController;
//import com.ruoyi.common.core.domain.AjaxResult;
//import com.ruoyi.common.enums.BusinessType;
//import com.ruoyi.tengxun.service.impl.ISmsService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.web.bind.annotation.*;
//
///**
// * 短信服务控制器
// */
//@RestController
//@RequestMapping("/lock/sms")
//public class SmsController extends BaseController {
//    @Autowired
//    private ISmsService smsService;
//
//    /**
//     * 发送登录验证码
//     */
//    @GetMapping("/code/{phoneNumber}")
//    public AjaxResult sendVerificationCode(@PathVariable String phoneNumber) {
//        // 生成6位数验证码
//        String code = String.valueOf((int) ((Math.random() * 9 + 1) * 100000));
//        boolean success = smsService.sendVerificationCode(phoneNumber, code);
//        if (success) {
//            // 在实际应用中，应该将验证码保存到缓存或数据库中，用于后续验证
//            return AjaxResult.success("验证码发送成功", code);
//        } else {
//            return AjaxResult.error("验证码发送失败");
//        }
//    }
//
//    /**
//     * 发送密码开通通知
//     */
//    @PreAuthorize("@ss.hasPermi('lock:sms:notify')")
//    @Log(title = "短信服务", businessType = BusinessType.OTHER)
//    @PostMapping("/notify/open/{phoneNumber}")
//    public AjaxResult sendPasswordOpenNotification(@PathVariable String phoneNumber) {
//        boolean success = smsService.sendPasswordOpenNotification(phoneNumber);
//        return toAjax(success);
//    }
//
//    /**
//     * 发送密码修改通知
//     */
//    @PreAuthorize("@ss.hasPermi('lock:sms:notify')")
//    @Log(title = "短信服务", businessType = BusinessType.OTHER)
//    @PostMapping("/notify/modify/{phoneNumber}")
//    public AjaxResult sendPasswordModifyNotification(@PathVariable String phoneNumber) {
//        boolean success = smsService.sendPasswordModifyNotification(phoneNumber);
//        return toAjax(success);
//    }
//
//    /**
//     * 发送续期通知
//     */
//    @PreAuthorize("@ss.hasPermi('lock:sms:notify')")
//    @Log(title = "短信服务", businessType = BusinessType.OTHER)
//    @PostMapping("/notify/renewal/{phoneNumber}")
//    public AjaxResult sendRenewalNotification(@PathVariable String phoneNumber) {
//        boolean success = smsService.sendRenewalNotification(phoneNumber);
//        return toAjax(success);
//    }
//}